<?php

class Html_Render_Group_Simple
{
    public function render($group)
    {
        $trans = Nuo::get('Translate');

        $tag = $group -> getMeta('tag','div');

        $xhtml = array();
        
        foreach ($group->getElements() as $element)
        {
            $label = $element -> getLabel();
            
            $noLabel = $element -> getNoLabel();
            
            $error = '';
            $html = $element -> render();

            if ($label && !$noLabel)
            {
                $label = $trans -> translate($label);
            }else{
                $label = '';
            }
            $xhtml[] = $label . $html;
        }
        return sprintf('<%s %s>%s</%s>', $tag, $group -> flatAttrib(), implode(PHP_EOL, $xhtml), $tag);
    }

}
